{% extends "baseD.html" %}

{% block headtitle %}- My Scenes{% endblock %}

{% block css %}
	<link href="/live3dstatic/css/viewAll.css" rel="stylesheet" type="text/css" media="screen" />
{% endblock %}

{% block scripts %}
	<script type="text/javascript">
		function toggleSearchBox() {
			var sbox = document.getElementById('searchstring');

			if ( sbox.value == "Search for..." ) {
				sbox.value = "";
				sbox.style.color = "#333333";
				toggleSearchOptions(1);
			} else if ( sbox.value == "" ) {
				sbox.style.color = "#999999";
				sbox.value = "Search for...";
				toggleSearchOptions(0);
			} else {
				sbox.style.color = "#333333";
				toggleSearchOptions(1);
			}
		}
		function toggleSearchOptions(opt) {
			var rcont = document.getElementById('radiocontainer');
			var topbar = document.getElementById('topbar');

			if ( opt == 1 ) {
				rcont.style.display = "block";
				topbar.style.margin = "0 0 -20px 0";
			} else {
				rcont.style.display = "none";
				topbar.style.margin = "0 0 -40px 0";
			}
		}
		function clearSearchBox() {
			document.getElementById('searchstring').value = "";
			toggleSearchBox();
			toggleSearchOptions(0);
		}
	</script>
{% endblock %}

{% block onload %} {% endblock %}

{% block divtitle %}- My Scenes{% endblock %}

{% block content %}
    <div id="contentpage" style="margin-left:40px; margin-right:40px;">
    	<div id="topbar">
			<div id="titlebox">
				<span class="title">Project Live 3D - View My Scenes</span>
			</div>
			<div id="searchbox">
				<form name="searchf" id="searchf" action="/viewAll" method="get" >
					<input type="text" id="searchstring" name="searchstring" value="Search for..." onfocus="toggleSearchBox()" onblur="toggleSearchBox()" />
					<input type="submit" id="searchstringsubmitbutton" value="Go">
					<br />
					<div style="clear:both;"></div>
					<div id="radiocontainer" style="margin:5px 0 0 5px;">
						<input type="radio" id="searchin" name="searchin" value="Name" checked="checked"/> Name
						<input type="radio" id="searchin" name="searchin" value="Owner" /> Owner
						<input type="radio" id="searchin" name="searchin" value="URL" /> URL
					</div>
				</form>
			</div><!-- end searchbox -->
			<div style="clear:both;"></div>
		</div>
	
		{% for scene in scenes %}
			<div class="group">
				<a href="viewScene?scene={{scene.index}}">
					<div class="imageshadow">
						{% ifnotequal scene.firstImage  "-1" %}
							<img src='/renderOriginalImage/{{scene.index}}.jpg' alt="" class="smallimage" />
						{% else %}
							<img src='{{scene.url}}' alt="" class="smallimage" />
						{% endifnotequal %}
					</div>
				</a>
				<div class="infocontainer">
					<div class="sceneInfo">
						<h3>
							{% if scene.name %}
								{{scene.name}}
							{% endif %}
						</h3>
						<p> Calibrated: 
							{% if scene.calibrated %}
								<span class="yes"> Yes </span>
							{% else %}
								<span class="no"> No </span>
							{% endif %}
						</p>
						<p>
							{% if scene.amosId %}
								AMOS Camera {{scene.amosId}}
							{% else %}
								&nbsp;
							{% endif %}
						</p>
						<p>
							{% if scene.is_private %}
								This scene is private.
							{% endif %}
								<div id="optionspanel">
									<table style="table-layout:fixed;width:100%"><tr>
										{% if scene.is_private %}
										<td style="width:50%; text-align:center">
										<form action='makePublic' method='post' >
											<input type='hidden' name='scene' value='{{scene.index}}'>
											<input type='submit' style="cursor:pointer;" value='Make Public'>
										</form>
										</td>
										{% endif %}
										<td  style="width:50%; text-align:center">
										<form action='adminModify' method='post' onsubmit="return confirm('Are you sure you want to delete the entire scene?  This is irreversible.');">
											<input type='hidden' name='scene' value='{{scene.index}}'>
											<input type='hidden' name='deleteScene' value='yes'>
											<input type='hidden' name='redirTo' value='myScenes'>
											<input type='submit' style="cursor:pointer;" value='Delete Scene'>
										</form>
									</td></tr></table>
								</div>
						</p>
					</div>
					<div class="rating">
						<p>
						{% if scene.ratingAverage %}
							{% for star in scene.stars %}
								{% if star %}
									<div class="star_on"></div>
								{% else %}
									<div class="star_off"></div>
								{% endif %}
								
							{% endfor %}
							<br/>
						</p>
						<p>
							{{ scene.ratingCount }} vote{{ scene.ratingCount|pluralize }}
						</p>
						{% endif %}
					</div>
					<div style="clear:both;"></div>
				</div>
				
			</div>
		{% endfor %}
		
		<div id="footerbox">
		{% for page in firstGroup %}
			<a class="pagenum" href="myScenes?page={{page}}"> {{page}} </a>
		{% endfor %}
		{% if prevEllipsis %} ... {% endif%}
		{% for page in prev %}
			<a class="pagenum" href="myScenes?page={{page}}"> {{page}} </a>
		{% endfor %}
		<p id="chosenpagenum">{{thisPage }}</p>
		{% for page in next %}
			<a class="pagenum" href="myScenes?page={{page}}"> {{page}} </a>
		{% endfor %}
		{% if nextEllipsis %} ... {% endif %}
		{% for page in lastGroup %}
			<a class="pagenum" href="myScenes?page={{page}}"> {{page}} </a>
		{% endfor %}
		</div>

    </div><!-- end contentpage --> 
{% endblock %}
		
{% block scripts2 %} {% endblock %}